<template>
    <div class="cropper-content">
        <a-row>
            <a-col :xs="{span: 24}" :md="{span:22, offset: 1}" :lg="{span:20, offset: 2}" class="contain">
                <video id="player-container" class="video" preload="auto" playsinline webkit-playsinline>
                </video>
            </a-col>
        </a-row>

    </div>
</template>

<script>
  export default {
    name: "liveIndex",
    data() {
      return {
        liveUrl: this.$route.query.liveUrl,
         player: {}
      }
    },
    mounted() {
      this.init ();
    },
    methods: {
      init () {
        var player = TCPlayer('player-container', {
        });
        this.player = player;
        var url = 'webrtc://onlive.mingyuefusu.top/live/' +this.liveUrl;
        player.src(url); // url 播放地址
      }
    },
    beforeRouteLeave(to, from, next) {
      this.player.dispose();
      console.log("已经删除");
      next();
    }
  }
</script>

<style scoped lang="scss">
.video {
    display: inline-block;
    width: 100%;
    height: 500px;
}
</style>

